﻿using Microsoft.AspNetCore.Mvc;
using MiniFox.Infrastructure;
using MiniFox.Platform.Applications.Web;
using MiniFox.Utility;
using MiniFox.Web.Filters;
using MiniFox.Web.Infrastructure;
using Sys.Core;
using Sys.Core.Models.Dto;
using Sys.Core.Models.Queries;
using Sys.Core.Models.VO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sys.Controllers
{
    [NoCache, ValidationFilter, Area(GlobalConstants.AREA_NAME)]
    public class SequenceController : AuthorizedController<ISequenceService>
    {
        [HttpPost]
        public Response<ResultObject<IEnumerable<SequenceSetVo>>> Query([FromBody] PagedQueryObject<SequenceSetQuery> request)
        {
            var result = this.Component.Query(request);
            return result.CreateResponse();
        }

        [HttpGet]
        public Response<SequenceSetVo> Item([FromQuery] string name)
        {
            SequenceSetVo item = this.Component.Item(name);
            return item.CreateResponse();
        }

        [HttpPost]
        public Response<SequenceSetVo> Create([FromBody] SequenceSetDto dto)
        {
            var result = this.Component.Create(dto);

            return result.CreateResponse();
        }

        [HttpPost]
        public Response<SequenceSetVo> Update([FromBody] SequenceSetDto dto)
        {
            var result = this.Component.Update(dto);

            return result.CreateResponse();
        }

        [HttpPost]
        public Response Remove([FromBody] string[] data)
        {
            this.Component.Remove(data);
            return new();
        }

        [HttpPost]
        public Response Reset([FromBody] string[] data)
        {
            this.Component.Reset(data);
            return new();
        }

    }
}
